parent nodes: PrefuseDoku

How To Generate a graph

There are two default ways to instantiate a graph:

manually instantiate a graph:
// standard constructur
Graph g = new Graph();

// add a column of type String, with name "label" and Type String to any table where it can be added;
// you can use any type that you want but if you want to use a DataSizeAction or any other DataAction 
// you should use int.class or double.class instead of Integer.class or Double.class
g.addColumn("label", String.class);

// create some Nodes           
Node n1 = g.addNode();    
Node n2 = g.addNode();
Node n3 = g.addNode();

// configure the nodes, i.e. fill the column        
n1.setString("label", "node one");
n2.setString("label", "node two");
n3.setString("label", "node three");
 
 // now some edges           
g.addEdge(n1, n2);
g.addEdge(n1, n3);

// finally add the graph to the visulatioan        
m_vis.addGraph("myGraph", g);
// the nodes are then ferenced by "myGraph.nodes", the edges by "myGraph.edges"

load a graphML file:
Graph g = new Graph();
g = new GraphMLReader().readGraph("path/to/file.xml");
m_vis.addGraph(GRAPH, g);